package Cantella::DJabberd::Web::Controller::Auth;

use base 'Reaction::UI::Controller';
use Reaction::Class;

__PACKAGE__->config(namespace => 'auth');

sub authed :Chained('/base') :PathPart('') :CaptureArgs(0) {
  my ($self, $c) = @_;
  unless( $c->has_current_user ){
    $c->forward('/error_403');
    $c->detach;
  }
  my $user = $c->current_user;
  my $menu = $c->stash->{menu};
  if(1) { #if( $user->assert_role('admin') ){
    $menu->add_item('admin', uri => "/admin");
  }
}

#sub logout :Chained('authed') :PathPart('logout') :Args(0) {
#  my ($self, $c) = @_;
#  $c->model('Admin')->_clear_current_user;
#  #forward somewhere useful
#}

1;
